/*
 * @(#)DeleteEventListener.java    Sep 16, 2010
 *
 * Copyright 2009 Nyber(Shanghai Itd. All rights reserved.
 */

package com.common.listener;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.event.EventSource;
import org.hibernate.event.def.DefaultDeleteEventListener;
import org.hibernate.persister.entity.EntityPersister;

/**
 * 刪除事件监听器.
 *
 * @author nickevin@gmail.com
 * @version Sep 16, 2010 10:57:39 AM
 */

public class DeleteEventListener extends DefaultDeleteEventListener {

    private static final long serialVersionUID = 1L;

    protected final Log logger = LogFactory.getLog(getClass());

    @Override
    protected boolean invokeDeleteLifecycle(EventSource session, Object entity,
            EntityPersister persister) {
        if (logger.isDebugEnabled()) {
            logger.debug("[delete] event, entity name: "
                    + entity.getClass().getName());
        }

        return super.invokeDeleteLifecycle(session, entity, persister);
    }

}
